#ifndef PRINTREG_H
#define PRINTREG_H

#include <iostream>

#ifndef UNO
	#define UNO 1
#endif

#ifndef ZERO
	#define ZERO 0
#endif



class PrintReg
{
public:
	
	static void PrintRecordStation(void *reg)
	{
		char * current = (char*)reg;
		unsigned int size = 0;
		char ptrCode[5 + UNO];
		char ptrNumber[8 + UNO];
		char ptrElevation[10 + UNO];
		char ptrLatitude[10 + UNO];
		char ptrLongitude[10 + UNO];

		memset(ptrCode, ZERO, 5  + UNO);
		memset(ptrNumber, ZERO, 8  + UNO);
		memset(ptrElevation, ZERO, 10  + UNO);
		memset(ptrLatitude, ZERO, 10  + UNO);
		memset(ptrLongitude, ZERO, 10 + UNO);

		memcpy(&size, current, sizeof(unsigned int));
		memcpy(ptrCode, current + sizeof(unsigned int), 5);
		memcpy(ptrNumber, current + sizeof(unsigned int) + 5, 8);
		memcpy(ptrElevation, current + sizeof(unsigned int) + 13, 10);
		memcpy(ptrLatitude, current + sizeof(unsigned int) + 23, 10);
		memcpy(ptrLongitude, current + sizeof(unsigned int) + 33, 10);
		
//		std::cout << std::endl;
//		for(unsigned int i=0; i < size; i++)
//		{
//			std::cout << "CHARACTER " << i << ": " << (char)((char*)reg)[i + sizeof(unsigned int)] << std::endl;
//		}
//		std::cout << std::endl;
		
		
		std::cout << "SIZE REG: " << size << std::endl;
		std::cout << "CODE: " << ptrCode << std::endl;
		std::cout << "NUMBER: " << ptrNumber << std::endl;
		std::cout << "ELEVATION: " << ptrElevation << std::endl;
		std::cout << "LATITUDE: " << ptrLatitude << std::endl;
		std::cout << "LONGITUDE: " << ptrLongitude << std::endl;
	}

	static void PrintRecordSounding(void *reg)
	{
		char * current = (char*)reg;
		unsigned int size = 0;
		char ptrPKSampleSounding[10 + UNO];
		char ptrStationCode[5 + UNO];
		char ptrBulk_richardson[10 + UNO];
		char ptrCape[10 + UNO];
		char ptrCape_virtual[10 + UNO];
		char ptrConvective_inhibition[10 + UNO];
		char ptrCross_totals_index[10 + UNO];
		char ptrDate[11 + UNO];
		char ptrHour[6 + UNO];
		char ptrK_index[10 + UNO];
		char ptrLifted[10 + UNO];
		char ptrLifted_virtual[10 + UNO];
		char ptrPrecipitable_water[10 + UNO];
		char ptrShowalter_index[10 + UNO];
		char ptrSweat_index[10 + UNO];
		char ptrTotals_totals_index[10 + UNO];
		char ptrVertical_totals_index[10 + UNO];

		memset(ptrPKSampleSounding, ZERO, 10 + UNO);
		memset(ptrStationCode, ZERO, 5 + UNO);
		memset(ptrBulk_richardson, ZERO, 10 + UNO);
		memset(ptrCape, ZERO, 10 + UNO);
		memset(ptrCape_virtual, ZERO, 10 + UNO);
		memset(ptrConvective_inhibition, ZERO, 10 + UNO);
		memset(ptrCross_totals_index, ZERO, 10 + UNO);
		memset(ptrDate, ZERO, 11 + UNO);
		memset(ptrHour, ZERO, 6 + UNO);
		memset(ptrK_index, ZERO, 10 + UNO);
		memset(ptrLifted, ZERO, 10 + UNO);
		memset(ptrLifted_virtual, ZERO, 10 + UNO);
		memset(ptrPrecipitable_water, ZERO, 10 + UNO);
		memset(ptrShowalter_index, ZERO, 10 + UNO);
		memset(ptrSweat_index, ZERO, 10 + UNO);
		memset(ptrTotals_totals_index, ZERO, 10 + UNO);
		memset(ptrVertical_totals_index, ZERO, 10 + UNO);

		memcpy(&size, current, sizeof(unsigned int));
		current += sizeof(unsigned int);
		memcpy(ptrPKSampleSounding, current, 10);
		current += 10;
		memcpy(ptrStationCode, current, 5);
		current += 5;
		memcpy(ptrBulk_richardson, current, 10);
		current += 10;
		memcpy(ptrCape, current, 10);
		current += 10;
		memcpy(ptrCape_virtual, current, 10);
		current += 10;
		memcpy(ptrConvective_inhibition, current, 10);
		current += 10;
		memcpy(ptrCross_totals_index, current, 10);
		current += 10;
		memcpy(ptrDate, current, 11);
		current += 11;
		memcpy(ptrHour, current, 6);
		current += 6;
		memcpy(ptrK_index, current, 10);
		current += 10;
		memcpy(ptrLifted, current, 10);
		current += 10;
		memcpy(ptrLifted_virtual, current, 10);
		current += 10;
		memcpy(ptrPrecipitable_water, current, 10);
		current += 10;
		memcpy(ptrShowalter_index, current, 10);
		current += 10;
		memcpy(ptrSweat_index, current, 10);
		current += 10;
		memcpy(ptrTotals_totals_index, current, 10);
		current += 10;
		memcpy(ptrVertical_totals_index, current, 10);
		
		
		std::cout << "SIZE REG: " << size << std::endl;
		std::cout << "ptrPKSampleSounding: " << ptrPKSampleSounding << std::endl;
		std::cout << "ptrStationCode: " << ptrStationCode << std::endl;
		std::cout << "ptrBulk_richardson: " << ptrBulk_richardson << std::endl;
		std::cout << "ptrCape: " << ptrCape<< std::endl;
		std::cout << "ptrCape_virtual: " << ptrCape_virtual << std::endl;
		std::cout << "ptrConvective_inhibition: " << ptrConvective_inhibition << std::endl;
		std::cout << "ptrCross_totals_index: " << ptrCross_totals_index << std::endl;
		std::cout << "ptrDate: " << ptrDate << std::endl;
		std::cout << "ptrHour: " << ptrHour << std::endl;
		std::cout << "ptrK_index: " << ptrK_index << std::endl;
		std::cout << "ptrLifted: " << ptrLifted << std::endl;
		std::cout << "ptrLifted_virtual: " << ptrLifted_virtual << std::endl;
		std::cout << "ptrPrecipitable_water: " << ptrPrecipitable_water<< std::endl;
		std::cout << "ptrShowalter_index: " << ptrShowalter_index << std::endl;
		std::cout << "ptrSweat_index: " << ptrSweat_index << std::endl;
		std::cout << "ptrTotals_totals_index: " << ptrTotals_totals_index << std::endl;
		std::cout << "ptrVertical_totals_index: " << ptrVertical_totals_index << std::endl;

	}

	static void PrintRecordSourcesafe(void *reg)
	{
		char * current = (char*)reg;
		unsigned int size = 0;
		char ptrPKSampleSourcesafe[10 + UNO];
		char ptrStationCode[5 + UNO];
		char ptrAltm[7 + UNO];
		char ptrDate[11 + UNO];
		char ptrDew[4 + UNO];
		char ptrDir[4 + UNO];
		char ptrGus[7 + UNO];
		char ptrHour[5 + UNO];
		char ptrRh[4 + UNO];
		char ptrSpd[4 + UNO];
		char ptrTmp[4 + UNO];
		char ptrVis[5 + UNO];
		char ptrWeather[15 + UNO];

		memset(ptrPKSampleSourcesafe, ZERO, 10 + UNO);
		memset(ptrStationCode, ZERO, 5 + UNO);
		memset(ptrAltm, ZERO, 7 + UNO);
		memset(ptrDate, ZERO, 11 + UNO);
		memset(ptrDew, ZERO, 4 + UNO);
		memset(ptrDir, ZERO, 4 + UNO);
		memset(ptrGus, ZERO, 7 + UNO);
		memset(ptrHour, ZERO, 5 + UNO);
		memset(ptrRh, ZERO, 4 + UNO);
		memset(ptrSpd, ZERO, 4 + UNO);
		memset(ptrTmp, ZERO, 4 + UNO);
		memset(ptrVis, ZERO, 5 + UNO);
		memset(ptrWeather, ZERO, 15 + UNO);

		memcpy(&size, current, sizeof(unsigned int));
		current += sizeof(unsigned int);
		memcpy(ptrPKSampleSourcesafe, current, 10);
		current += 10;
		memcpy(ptrStationCode, current, 5);
		current += 5;
		memcpy(ptrAltm, current, 7 );
		current += 7;
		memcpy(ptrDate, current, 11 );
		current += 11;
		memcpy(ptrDew, current, 4 );
		current += 4;
		memcpy(ptrDir, current, 4 );
		current += 4;
		memcpy(ptrGus, current, 7 );
		current += 7;
		memcpy(ptrHour, current, 5 );
		current += 5;
		memcpy(ptrRh, current, 4 );
		current += 4;
		memcpy(ptrSpd, current, 4 );
		current += 4;
		memcpy(ptrTmp, current, 4 );
		current += 4;
		memcpy(ptrVis, current, 5 );
		current += 5;
		memcpy(ptrWeather, current, 15);
		

		std::cout << "SIZE REG: " << size << std::endl;
		std::cout << "PKSAMPLESOURCESAFE: " << ptrPKSampleSourcesafe << std::endl;
		std::cout << "STATIONCODE: " << ptrStationCode << std::endl;
		std::cout << "ALTM: " << ptrAltm << std::endl;
		std::cout << "DATE: " << ptrDate << std::endl;
		std::cout << "DEW: " << ptrDew << std::endl;
		std::cout << "DIR: " << ptrDir << std::endl;
		std::cout << "GUS: " << ptrGus << std::endl;
		std::cout << "HOUR: " << ptrHour << std::endl;
		std::cout << "RH: " << ptrRh << std::endl;
		std::cout << "SPD: " << ptrSpd << std::endl;
		std::cout << "TMP: " << ptrTmp << std::endl;
		std::cout << "VIS: " << ptrVis << std::endl;
		std::cout << "WEATHER: " << ptrWeather << std::endl;
	}

	static void PrintRecordCondition(void *reg)
	{
		char * current = (char*)reg;
		unsigned int size = 0;
		char ptrPKConditionAtm[10 + UNO];
		char ptrStationCode[5 + UNO];
		char ptrDate[11 + UNO];
		char ptrDrct[7 + UNO];
		char ptrDwpt[7 + UNO];
		char ptrHght[7 + UNO];
		char ptrMixr[7 + UNO];
		char ptrPres[7 + UNO];
		char ptrRelh[7 + UNO];
		char ptrSknt[7 + UNO];
		char ptrTemp[7 + UNO];
		char ptrThta[7 + UNO];
		char ptrThte[7 + UNO];
		char ptrThtv[7 + UNO];

		memset(ptrPKConditionAtm, ZERO, 10 + UNO);
		memset(ptrStationCode, ZERO, 5 + UNO);
		memset(ptrDate, ZERO, 11 + UNO);
		memset(ptrDrct, ZERO, 7 + UNO);
		memset(ptrDwpt, ZERO, 7 + UNO);
		memset(ptrHght, ZERO, 7 + UNO);
		memset(ptrMixr, ZERO, 7 + UNO);
		memset(ptrPres, ZERO, 7 + UNO);
		memset(ptrRelh, ZERO, 7 + UNO);
		memset(ptrSknt, ZERO, 7 + UNO);
		memset(ptrTemp, ZERO, 7 + UNO);
		memset(ptrThta, ZERO, 7 + UNO);
		memset(ptrThte, ZERO, 7 + UNO);
		memset(ptrThtv, ZERO, 7 + UNO);

		memcpy(&size, current, sizeof(unsigned int));
		current += sizeof(unsigned int);
		memcpy(ptrPKConditionAtm, current, 10);
		current += 10;
		memcpy(ptrStationCode, current, 5);
		current += 5;
		memcpy(ptrDate, current, 11 );
		current += 7;
		memcpy(ptrDrct, current, 7 );
		current += 7;
		memcpy(ptrDwpt, current, 7 );
		current += 7;
		memcpy(ptrHght, current, 7 );
		current += 7;
		memcpy(ptrMixr, current, 7 );
		current += 7;
		memcpy(ptrPres, current, 7 );
		current += 7;
		memcpy(ptrRelh, current, 7 );
		current += 7;
		memcpy(ptrSknt, current, 7 );
		current += 7;
		memcpy(ptrTemp, current, 7 );
		current += 7;
		memcpy(ptrThta, current, 7 );
		current += 7;
		memcpy(ptrThte, current, 7 );
		current += 7;
		memcpy(ptrThtv, current, 7 );
		
		std::cout << "SIZE REG: " << size << std::endl;
		std::cout << "PKCONDITIONATM: " << ptrPKConditionAtm << std::endl;
		std::cout << "STATIONCODE: " << ptrStationCode << std::endl;
		std::cout << "DATE: " << ptrDate << std::endl;
		std::cout << "DRCT: " << ptrDrct << std::endl;
		std::cout << "DWPT: " << ptrDwpt << std::endl;
		std::cout << "HGHT: " << ptrHght << std::endl;
		std::cout << "MIXR: " << ptrMixr << std::endl;
		std::cout << "PRES: " << ptrPres << std::endl;
		std::cout << "RELH: " << ptrRelh << std::endl;
		std::cout << "SKNT: " << ptrSknt << std::endl;
		std::cout << "TEMP: " << ptrTemp << std::endl;
		std::cout << "THTA: " << ptrThta << std::endl;
		std::cout << "THTE: " << ptrThte << std::endl;
		std::cout << "THTV: " << ptrThtv<< std::endl;
	}

	static void PrintRecordCloudLayer(void *reg)
	{
		char * current = (char*)reg;
		unsigned int size = 0;
		char ptrPKCloudLayer[10 + UNO];
		char ptrStationCode[10 + UNO];
		char ptrHeight[4 + UNO];
		char ptrType[4  + UNO];
		char ptrDate[11 + UNO];

		memset(ptrPKCloudLayer, ZERO, 10 + UNO);
		memset(ptrStationCode, ZERO, 10 + UNO);
		memset(ptrHeight, ZERO, 4 + UNO);
		memset(ptrType, ZERO, 4 + UNO);
		memset(ptrDate, ZERO, 11 + UNO);

		memcpy(&size, current, sizeof(unsigned int));
		current += sizeof(unsigned int);
		memcpy(ptrPKCloudLayer, current, 10);
		current += 10;
		memcpy(ptrStationCode, current, 5);
		current += 5;
		memcpy(ptrHeight, current, 4 );
		current += 4;
		memcpy(ptrType, current, 4 );
		current += 4;
		memcpy(ptrDate, current, 11 );
		
		std::cout << "SIZE REG: " << size << std::endl;
		std::cout << "PKCLOUDLAYER: " << ptrPKCloudLayer << std::endl;
		std::cout << "STATIONCODE: " << ptrStationCode << std::endl;
		std::cout << "HEIGHT: " << ptrHeight << std::endl;
		std::cout << "TYPE: " << ptrType << std::endl;
		std::cout << "DATE: " << ptrDate << std::endl;
	}

	
};

#endif

